#ifndef __DB_H__
#define __DB_H__

#include <iostream>
#include <acl_cpp/stdlib/string.hpp>

#include <common/private_hid.h>

namespace ECG
{
namespace DB
{
   class DB_RedisPrivate;

   class DB_Redis{
    public:
        bool connect(const char*addr,const char* passwd=NULL,int conn_timeout=60);
        //void disconnect();
        static DB_Redis* instance();
        void destroy();
        int lpush(const char* key, const char* values[], const size_t lens[],size_t argc); // add elemets to the head of a list
        int rpush(const char* key, const char* values[], const size_t lens[],size_t argc); // add elmemts to the tail of a list
        int length(const char* key); // the length of list in database
        int lpop(const char* key, acl::string& buf); // remove element frome the head of list
        int rpop(const char* key, acl::string& buf); // remove element frome the tail of list
    private:
        static DB_Redis *m_dbRedis;
        DB_Redis();
        virtual ~DB_Redis();
        E_DECLARE_PRIVATE(DB_Redis);
        DB_RedisPrivate * const d_ptr; // hid members

   }; 
}
}

#endif //__DB_H__